<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html class="win-frame">
<head>
 <title>${name_china}管理-查看${name_china}</title>
 <%@include file="/common/head.jsp" %>
 <link href="<%=request.getContextPath()%>/static/plugin/zTree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet">
 <script src="<%=request.getContextPath()%>/static/plugin/zTree/js/jquery.ztree.all-3.5.min.js"></script>
</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
            <span class="split"></span>
            <span>${name_china}详情</span>
        </div>
        <a id="goBack" class="btn-return distance-left" href="javascript:;" onclick="parent.refreshList('${org.code}');"><i class="icon icon-arrow-left"></i>返回上级</a>
    </div>
    <div class="page-title-border"></div>
</div>

<form id="form">
<div class="left-wrap">
   <h3>用户提现信息</h3>
    <table class="table-view">
        <tr>
	       <td class="td-title">用户昵称</td>
	       <td><span name="userName"></span></td>
        </tr>
         <tr>
	       <td class="td-title">用户头像</td>
	       <td id="userHeadImg"></td>
        </tr>
         <tr>
	       <td class="td-title">提现类型</td>
	       <td><span name="type"></span></td>
        </tr>
         <tr>
	       <td class="td-title">提现金额</td>
	       <td><span name="money"></span></td>
        </tr>
         <tr>
	       <td class="td-title">提现账号名称</td>
	       <td><span name="zfbName"></span></td>
        </tr>
        <tr>
	       <td class="td-title">提现账号</td>
	       <td><span name="zfbAccount"></span></td>
        </tr>
        <tr>
	       <td class="td-title">备注</td>
	       <td><span name="note"></span></td>
        </tr>
    </table>
    <h3>用户历史收益信息</h3>
    <div class="search-field">
    <span class="field-cont">
        <span class="field-cont-title">用户昵称</span>
        <input type="text" class="summer-input" id="name"/>
    </span>
    
    
    <span class="field-btn-wrapper">
        <a id="search" class="btn btn-primary btn-icon wave distance-right"><i class="icon icon-search"></i></a>
        <a id="reset" class="btn btn-icon wave wave-dark"><i class="icon icon-refresh"></i></a>
    </span>
</div>

<div id="t-wrap">
    <table style="width:1000px;" class="summer-datagrid" id="dataList">
        
	    <thead>
		    <tr>
		        <th>用户昵称</th>
		        <th>订单总金额</th>
		        <th>订单号码</th>
		        <th>收益金额</th>
				<th>描述</th>
		    </tr>
	    </thead>
    </table>
</div>
 </div>     

<input type="hidden" id="id" name="id"/> 
</form>
<script>
var   viewData;
      
   $(function(){
	 
	   viewData = ${viewEdit};
	   
	   $("#form").form().form("loadDataView",{
	   		  data : viewData
	   }); 
	   $('#userHeadImg').append("<img src='"+viewData.userHeadImg+"' style='weight:100px;height:100px;'></img>");
	   $("#id").val(viewData.id);
	   
	   $('#backBtn').on('click', backHome);
	   
		//保存按钮
      	$('#funcbar').on('click', 'a[data-permit="${name_english}:fafang"]', submit);
        //保存按钮
      	$('#funcbar').on('click', 'a[data-permit="${name_english}:falsess"]', submitFalse);
   
      	 // 查询按钮
        $('#search').on('click', reloadTable);
        
        //重置按钮
        $('#reset').on('click', function () {
        	//重置文本框的值
        	//$('#name').val('');
        	
        	reloadTable();
        });
        
        createTable();
        
   });
   
   // 重新加载表格
	function reloadTable() {
		$('#dataList').datagrid('reload',{
           ajax: {
           	param: {
           		"userId": viewData.userId
           	}
           }
       });
	}
   
   //创建表格
   function createTable() {
   	$('#dataList').datagrid({
   		ajax: {
   			url: CONST_URL.LIST,
   			param: {
   				"userId": viewData.userId
           	}
   		},
   		columns: [
   		     {
   		    	 field: 'id',
   		    	 hidden: true
   		     },
   		     {
   		    	 field: 'userNickName'
   		     },
   		     {
   		    	 field: 'orderTotalMoney'
   		     },
   		     {
   		    	 field: 'orderNum'
   		     },
   		     {
   		    	 field: 'money'
   		     },
   		     {
   		    	 field: 'note'
   		     }
   	    ]
   	});
   }
   
   //表单提交
   function submit() {
        $("#form").form({
       	 buttons : ['#saveBtn'],
            ajax: {
                url: CONST_URL.FAFANG
            },
            onSubmitSuccess: function (data) {
           	 $.stip({
  	                type:'ok',//显示类型 有info、 ok、 danger
  	                text: '发放成功！',
  	                onBeforeHide: function () {
  	                	backHome();
  	                }
           	 });
             }
        }).form("submit");
   }
   
 //表单提交
   function submitFalse() {
        $("#form").form({
       	 buttons : ['#saveBtn'],
            ajax: {
                url: CONST_URL.FALSESS
            },
            onSubmitSuccess: function (data) {
           	 $.stip({
  	                type:'ok',//显示类型 有info、 ok、 danger
  	                text: '发放失败！',
  	                onBeforeHide: function () {
  	                	backHome();
  	                }
           	 });
             }
        }).form("submit");
   }
   
   function backHome() {
      window.location.href =  basePath + "${common_url}init";
   }
   
 //请求url
   var CONST_URL = {
		 LIST: basePath + "${common_url}listProfit",
		 FALSESS: basePath + "${common_url}falsess",
		 FAFANG: basePath + "${common_url}fafang"
   };
   
</script>
</body>
</html>